#! /bin/sh
# Copyright © 2008 Rémi Denis-Courmont

cd "$(dirname "$0")" || exit $?

# Look for configure #defines in public headers.
# There are incorrect, as external users don't have our <config.h>.
regexp=""

while read l; do
	d=$(echo "$l" | sed -n -e 's/^#undef \([[:upper:][:digit:]_]*\)$/\1/p')
	test -z "$d" && continue
	test "$d" = "WORDS_BIGENDIAN" && continue
	test "$d" = "UNICODE" && continue
	test "$d" = "LIBVLC_INTERNAL_" && continue

	if test -z "$regexp"; then
		regexp="[^A-Za-z0-9_]\("
	else
		regexp="${regexp}\|"
	fi
	regexp="${regexp}${d}"
done < ../config.h.in
regexp="${regexp}\)\([^A-Za-z0-9_]\|\$\)"

echo Looking for private defines in public headers...
! grep -- "$regexp" "$@" || exit $?
echo "None found."
